home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / VideoFolder 1.0a / Source / MoreFiles 1.4.1 / FileCopy.h < prev    next >
Text File  |  1995-12-21  |  5KB  |  141 lines

  1. /*
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    FileCopy: A robust, general purpose file copy routine.
  5. **
  6. **    by Jim Luther, Apple Developer Technical Support Emeritus
  7. **
  8. **    File:        FileCopy.h
  9. **
  10. **    Copyright © 1992-1995 Apple Computer, Inc.
  11. **    All rights reserved.
  12. **
  13. **    You may incorporate this sample code into your applications without
  14. **    restriction, though the sample code has been provided "AS IS" and the
  15. **    responsibility for its operation is 100% yours.  However, what you are
  16. **    not permitted to do is to redistribute the source as "DSC Sample Code"
  17. **    after having made changes. If you're going to re-distribute the source,
  18. **    we require that you make it clear in the source that the code was
  19. **    descended from Apple Sample Code, but that you've made changes.
  20. */
  21.  
  22. #ifndef __FILECOPY__
  23. #define __FILECOPY__
  24.  
  25. #include <Types.h>
  26. #include <Files.h>
  27.  
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31.  
  32. /*****************************************************************************/
  33.  
  34. pascal    OSErr    FileCopy(short srcVRefNum,
  35.                          long srcDirID,
  36.                          ConstStr255Param srcName,
  37.                          short dstVRefNum,
  38.                          long dstDirID,
  39.                          StringPtr dstPathname,
  40.                          StringPtr copyName,
  41.                          void *copyBufferPtr,
  42.                          long copyBufferSize,
  43.                          Boolean preflight);
  44. /*    ¶ Duplicate a file and optionally rename it.
  45.     The FileCopy function duplicates a file and optionally renames it.
  46.     Since the PBHCopyFile routine is only available on some
  47.     AFP server volumes under specific conditions, this routine
  48.     either uses PBHCopyFile, or does all of the work PBHCopyFile
  49.     does.  The srcVRefNum, srcDirID and srcName are used to
  50.     determine the location of the file to copy.  The dstVRefNum
  51.     dstDirID and dstPathname are used to determine the location of
  52.     the destination directory.  If copyName <> NIL, then it points
  53.     to the name of the new file.  If copyBufferPtr <> NIL, it
  54.     points to a buffer of copyBufferSize that is used to copy
  55.     the file's data.  The larger the supplied buffer, the
  56.     faster the copy.  If copyBufferPtr = NIL, then this routine
  57.     allocates a buffer in the application heap. If you pass a
  58.     copy buffer to this routine, make its size a multiple of 512
  59.     ($200) bytes for optimum performance.
  60.     
  61.     srcVRefNum        input:    Source volume specification.
  62.     srcDirID        input:    Source directory ID.
  63.     srcName            input:    Source file name.
  64.     dstVRefNum        input:    Destination volume specification.
  65.     dstDirID        input:    Destination directory ID.
  66.     dstPathname        input:    Pointer to destination directory name, or
  67.                             nil when dstDirID specifies a directory.
  68.     copyName        input:    Points to the new file name if the file is
  69.                             to be renamed or nil if the file isn't to
  70.                             be renamed.
  71.     copyBufferPtr    input:    Points to a buffer of copyBufferSize that
  72.                             is used the i/o buffer for the copy or
  73.                             nil if you want FileCopy to allocate its
  74.                             own buffer in the application heap.
  75.     copyBufferSize    input:    The size of the buffer pointed to
  76.                             by copyBufferPtr.
  77.     preflight        input:    If true, FileCopy makes sure there are enough
  78.                             allocation blocks on the destination volume to
  79.                             hold both the data and resource forks before
  80.                             starting the copy.
  81.  
  82.     __________
  83.     
  84.     Also see:    FSpFileCopy, DirectoryCopy, FSpDirectoryCopy
  85. */
  86.  
  87. /*****************************************************************************/
  88.  
  89. pascal    OSErr    FSpFileCopy(const FSSpec *srcSpec,
  90.                             const FSSpec *dstSpec,
  91.                             StringPtr copyName,
  92.                             void *copyBufferPtr,
  93.                             long copyBufferSize,
  94.                             Boolean preflight);
  95. /*    ¶ Duplicate a file and optionally rename it.
  96.     The FSpFileCopy function duplicates a file and optionally renames it.
  97.     Since the PBHCopyFile routine is only available on some
  98.     AFP server volumes under specific conditions, this routine
  99.     either uses PBHCopyFile, or does all of the work PBHCopyFile
  100.     does.  The srcSpec is used to
  101.     determine the location of the file to copy.  The dstSpec is
  102.     used to determine the location of the
  103.     destination directory.  If copyName <> NIL, then it points
  104.     to the name of the new file.  If copyBufferPtr <> NIL, it
  105.     points to a buffer of copyBufferSize that is used to copy
  106.     the file's data.  The larger the supplied buffer, the
  107.     faster the copy.  If copyBufferPtr = NIL, then this routine
  108.     allocates a buffer in the application heap. If you pass a
  109.     copy buffer to this routine, make its size a multiple of 512
  110.     ($200) bytes for optimum performance.
  111.     
  112.     srcSpec            input:    An FSSpec record specifying the source file.
  113.     dstSpec            input:    An FSSpec record specifying the destination
  114.                             directory.
  115.     copyName        input:    Points to the new file name if the file is
  116.                             to be renamed or nil if the file isn't to
  117.                             be renamed.
  118.     copyBufferPtr    input:    Points to a buffer of copyBufferSize that
  119.                             is used the i/o buffer for the copy or
  120.                             nil if you want FileCopy to allocate its
  121.                             own buffer in the application heap.
  122.     copyBufferSize    input:    The size of the buffer pointed to
  123.                             by copyBufferPtr.
  124.     preflight        input:    If true, FSpFileCopy makes sure there are
  125.                             enough allocation blocks on the destination
  126.                             volume to hold both the data and resource forks
  127.                             before starting the copy.
  128.  
  129.     __________
  130.     
  131.     Also see:    FileCopy, DirectoryCopy, FSpDirectoryCopy
  132. */
  133.  
  134. /*****************************************************************************/
  135.  
  136. #ifdef __cplusplus
  137. }
  138. #endif
  139.  
  140. #endif    /* __FILECOPY__ */
  141.